#!/usr/bin/env python
# coding=utf8

from . import db
from . import ORMBase

class User(ORMBase, db.Model):
    __tablename__ = 'user'

    id = db.Column(db.Integer, primary_key=True, doc="主键")
    login = db.Column(db.String(50), doc="登陆身份")
    password = db.Column(db.String(100), doc="登陆密钥")

    @staticmethod
    def get_by_login(login):
        return User.query.filter_by(login=login).first()

    @staticmethod
    def get_user(login, password):
        return User.query.filter_by(login=login, password=password).first()
